package com.evil.common.core.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Collection;

/**
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FindByStringsReqDTO {

    /**
     * strings
     */
    @NotEmpty(message = "strings cant not empty")
    private Collection<String> strings;

    /**
     * 是否过滤已删除
     */
    @NotNull(message = "filterDeleted cant not null")
    private Boolean filterDeleted;

    /**
     * 是否会话缓存
     */
    @NotNull(message = "cache cant not null")
    private Boolean cache;

    public static FindByStringsReqDTO filter(Collection<String> strings) {
        return new FindByStringsReqDTO(strings, true, false);
    }

    public static FindByStringsReqDTO unFilter(Collection<String> strings) {
        return new FindByStringsReqDTO(strings, false, false);
    }

    public static FindByStringsReqDTO filterCache(Collection<String> strings) {
        return new FindByStringsReqDTO(strings, true, true);
    }

    public static FindByStringsReqDTO unFilterCache(Collection<String> strings) {
        return new FindByStringsReqDTO(strings, false, true);
    }
}
